#include "cfolderuploadlib.h"
#include "FolderUploader.h"

std::mutex createMutex;
FolderUploader* uniquePtr = NULL;

CFolderUploadLib *CreateLibObject(int id)
{
    std::lock_guard<std::mutex> lock(createMutex);
    if (NULL == uniquePtr)    
        uniquePtr = new FolderUploader(id);
    
    return uniquePtr;
}

void DestorytLibObject(CFolderUploadLib *obj)
{    
    std::lock_guard<std::mutex> lock(createMutex);
    if (uniquePtr)
    {
        delete uniquePtr;
        uniquePtr = NULL;
    }
}
